//
//  SFKHTTPTool.h
//  SFKStudentCenterNew
//
//  Created by sfk-ios on 2017/4/17.
//  Copyright © 2017年 北京斯芬克教育咨询有限公司. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AFNetworking.h"
#import "AFHTTPSessionManager.h"

typedef void (^successBlock) (NSURLSessionTask *task, id JSON);
typedef void (^failureBlock) (NSURLSessionTask *operation, NSError *error);

typedef void (^SHNetworkStatusChangeBlock) (AFNetworkReachabilityStatus status);

@interface SFKHTTPTool : NSObject

+ (void)GET:(NSString *)urlString parameters:(id)parameters success:(successBlock)success failure:(failureBlock)failure;

+ (void)POST:(NSString *)urlString parameters:(id)parameters success:(successBlock)success failure:(failureBlock)failure;

//+ (__kindof NSURLSessionTask *)operationMethod:(NSString *)method urlString:(NSString *)urlString parameters:(id)parameters success:(successBlock)success failure:(failureBlock)failure;

- (void)GET:(NSString *)urlString parameters:(id)parameters success:(successBlock)success failure:(failureBlock)failure;

- (void)POST:(NSString *)urlString parameters:(id)parameters success:(successBlock)success failure:(failureBlock)failure;

/**
 *  监控网络状态的变化
 */
+ (void)monitorNetworkStatusChange:(SHNetworkStatusChangeBlock)statusChangeBlock;
/**
 *  取消网络请求
 */
+ (void)cancelAllOperations;
- (void)cancelAllOperations;
/**
 *  是否是WIFI网络
 */
+ (BOOL)isWiFi;
/**
 *  网络是否连接
 */
+ (BOOL)isReachable;

/// 超时
@property (assign, nonatomic) CGFloat timeOut;

@end
